<template>
	<view class="container">
		<view class="" style="display: flex;align-items: center;margin-top: 0px;">
			<view class="tag">车牌号码：</view>
			<uni-easyinput v-model="user.t1" placeholder="请输入车牌号码" />
		</view>
		<view class="" style="display: flex;align-items: center;margin-top: 20px;">
			<view class="tag">车位号：</view>
			<uni-easyinput v-model="user.t2" type="text" placeholder="请输入车位号" />
		</view>
		<view class="" style="display: flex;align-items: center;margin-top: 20px;">
			<view class="tag">停车卡号：</view>
			<uni-easyinput v-model="user.t3" type="text" placeholder="请输入停车卡号" />
		</view>
		<view class="" style="display: flex;align-items: center;margin-top: 20px;">
			<view class="tag">车主姓名：</view>
			<uni-easyinput v-model="user.t4" type="text" placeholder="请输入车主姓名" />
		</view>
		<view class="" style="display: flex;align-items: center;margin-top: 20px;">
			<view class="tag">车主手机号：</view>
			<uni-easyinput v-model="user.t5" type="number" maxlength="11" placeholder="请输入车主手机号" />
		</view>
		<view class="" style="display: flex;margin-top: 20px;flex-direction: column;">
			<view class="" style="margin-bottom: 5px;">相关住户姓名：</view>
			<uni-easyinput v-model="user.t6" placeholder="请输入相关住户姓名" />
		</view>
		<view class="" style="display: flex;margin-top: 20px;flex-direction: column;">
			<view class="" style="margin-bottom: 5px;">相关住户地址：</view>
			<uni-easyinput v-model="user.t7" placeholder="请输入相关住户地址" />
		</view>
		<button type="primary" @click="submit" style="margin-top: 20px;">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					t1: "",
					t2: "",
					t3: "",
					t4: "",
					t5: "",
				},
				index: 0
			};
		},
		onLoad(item) {
			this.user = JSON.parse(item.data)
			this.index = item.index
		},
		onReady() {

		},
		onShow() {

		},
		methods: {
			submit() {
				this.isEmpty(this.user)
				this.$request.t5.splice(this.index, 1, JSON.parse(JSON.stringify(this.user)))
				uni.showToast({
					title: '修改成功',
					icon: 'none'
				});
				setTimeout(function() {
					uni.navigateBack({
						delta: 1
					});
				}, 300);
			}
		}
	};
</script>

<style lang="scss">
	page {
		background-color: white;
	}

	.tag {
		width: 6em;
	}
</style>
